#pragma once
#include <iostream>
#include "Player.h"
#include "Move.h"
/** \class GameState
	\brief Class that holds information and methods for current game

	GameState is a baseclass which is inheritated by your own
	YOURGAMEGameState.h. There you have to implement 
	startState(), getLegalMoves(), movePiece()
	Your Derived class also have to have a member variable of
	the type YOURGAMERules (ex.. BreakthroughRules m_rules;)
*/
class GameState
{
public:
	/**
	* Empty constructor
	*/
	GameState();

	/**
	* Virtual destructor
	*/
	virtual ~GameState();

	/**
	*	Initilize the board and players
	*	Your implementations should call the GameState() constructor and then
	*	initPlayers in your rules class.
	*/
	void startState(std::vector< std::vector<char> >& grid);

	/**
	*	Moves piece from one location to another.
	*	Your implementation should call the isLegal() function in your
	*	Rules class, and then call the MovePiece() funcion in Gamestate if legal.
	*/
	void movePiece(std::vector< std::vector<char> >& grid, int fromX, int fromY, int toX, int toY);
	
	/**
	* Returns number of moves made
	*/
	int getNumMoves();

	/**
	* Prints out number of pieces for each player
	*/
	void printPieces();

	/**
	* Retract the last move played
	* takes the grid for the board as argument
	*/
	void retract(std::vector< std::vector<char> >& grid);

	/**
	* Evaluates the current gamestate
	*/
	int getEvaluation();

	/**
	*	Returns the current Player
	*/
	int getCurrentPlayer() { return m_currentPlayer; }
	
	/**
	*	Returns all legal moves possible from current position
	*/
	std::vector<Move> getLegalMoves(std::vector< std::vector<char> >& grid);

protected:
	int m_currentPlayer; ///< Current player
	Player *m_players; ///< The players which are playing
	int m_numMoves; ///< Number of moves made
	Move m_moves; ///< Last move made
};

